import 'dart:ui';

import 'package:flame/components.dart';
/**
 * SpriteComponent:单图
 * SpriteAnimationComponent： 多图
* */
class HeroComponent extends SpriteAnimationComponent{


  HeroComponent(): super(size: Vector2(50,37), anchor: Anchor.center);
  Future<dynamic> onLoad() async {
    List<Sprite> sprites = [];
    for(int i=0;i<9;i++){
      sprites.add(await Sprite.load('adventurer-bow-0$i.png'));
    }
    animation =  SpriteAnimation.spriteList(sprites, stepTime: 1.5)
  }

  @override
  void onGameResize(Vector2 size) {
      position =  size / 2;
  }
}